package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.OrderBean;
import com.xuxin.baby.contract.UserOrderContract;
import com.xuxin.baby.model.UserOrderModel;

/**
 * Created by xu_xin
 * Created on 2020/10/23 0023
 * 我的订单
 */
public class UserOrderPresenter implements UserOrderContract.Presenter {
    private  final UserOrderModel model;
    private final  UserOrderContract.View view;

    public UserOrderPresenter(UserOrderContract.View view) {
        this.view = view;
        model = new UserOrderModel();
    }

    @Override
    public void getUserOrder(String tenantId, String token, String memberId, int skipCount) {
        if (null != model) {
            model.getUserOrder(this, tenantId, token, memberId, skipCount);
        }
    }

    @Override
    public void onSuccess(OrderBean orderBean) {
        if (null != view) {
            view.onSuccess(orderBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}